/**
 * Created by lijing on 2016-06-22.
 */
$.validator.setDefaults({
    submitHandler: function () {
        savePub();
    }
});
$(document).ready(function () {
    validate();
    $("#file_upload").att({
        'scriptData': {
            'id': id,
        },
        'key': "resumeWorkExperience",
        'url':"logo"
    });

});

function savePub() {
    $.post(G_Path.path + "/resume/work/experience/save?resumeId="+resumeId, $("#mainForm").serialize(), function (text) {
        var data = $.parseJSON(text);
        if(data.success){
            if ("view" == status) {
                history.back();
            } else {
                window.close();
            }
        }
    });
}

function  validate(){
    ////设置默认属性
    $("#mainForm").validate({
        rules: {
            name: {
                required: true,
                minlength: 1
            }
        },
        messages: {
            name: {
                required: "请输入公司名称",
                minlength: ""
            }
        }
    });
}